home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C++ / Applications / SeeMovieRun 2.0 / Source / CQTDoc.cp < prev    next >
Encoding:
Text File  |  1995-08-02  |  4.2 KB  |  167 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CQTDoc.cp
  3.  
  4.                 CQTDoc Document Class
  5.     
  6.     Copyright © 1995 Gregory Bonk, NewMedia Inc. All rights reserved.
  7.  
  8.     Generated by Visual Architect™ 5:28 PM Tue, Aug 1, 1995
  9.  
  10.     Portions Copyright © 1992 Joe Zobkiw.  All rights reserved.
  11.     Portions Copyright © 1995 Symantec Corporation.  All rights reserved.
  12.  ******************************************************************************/
  13.  
  14. #include "CQTDoc.h"
  15. #include "AppCommands.h"            // Remove comments if DoCommand overridden
  16.  
  17. #include <CApplication.h>
  18. #include "Movies.h"
  19. #include "QuickTime Utilities.h"
  20. #include "CQTPane.h"
  21.  
  22.  
  23. extern    CBartender    *gBartender;    /* The menu handling object */
  24.  
  25. TCL_DEFINE_CLASS_M1(CQTDoc, x_CQTDoc);
  26.  
  27. /**** C O N S T R U C T I O N / D E S T R U C T I O N   M E T H O D S ****/
  28.  
  29. CQTDoc::CQTDoc()
  30. {
  31.     TCL_END_CONSTRUCTOR
  32. }
  33.  
  34.  
  35. CQTDoc::~CQTDoc()
  36. {
  37.     TCL_START_DESTRUCTOR
  38. }
  39.  
  40.  
  41. /******************************************************************************
  42.  ICQTDoc
  43.  
  44.     Initialize the document
  45.  
  46.  ******************************************************************************/
  47. void CQTDoc::ICQTDoc()
  48. {
  49.     Ix_CQTDoc();
  50. }
  51.  
  52. /******************************************************************************
  53.  MakeNewWindow
  54.  
  55.     Create a new, empty window.  Subclass may override to populate
  56.     the new window.
  57.  ******************************************************************************/
  58. void CQTDoc::MakeNewWindow(void)
  59. {
  60.     CQTPane *theQOPane;
  61.     CScrollPane        *theScrollPane;
  62.  
  63.     inherited:: MakeNewWindow();
  64.  
  65.     theScrollPane = new CScrollPane(itsWindow, this, 10, 10, 0, 0,
  66.                                 sizELASTIC, sizELASTIC,    TRUE, TRUE, TRUE);
  67.  
  68.  
  69.     theScrollPane->FitToEnclFrame(TRUE, TRUE);
  70.  
  71.     theQOPane = new CQTPane();
  72.     theQOPane->IQTPane(theScrollPane, this, 0, 0, 0, 0, sizELASTIC, sizELASTIC, NULL);
  73.     itsGopher = itsMainPane = theQOPane;
  74.     
  75.     itsMainPane->FitToEnclosure(TRUE, TRUE);
  76.     theScrollPane->InstallPanorama(theQOPane);
  77. }
  78.  
  79. /******************************************************************************
  80.  MakeNewContents
  81.  
  82.     Create "blank" document contents. MakeNewContents is called
  83.     after itsWindow is created and before it is first selected,
  84.     whether or not the document uses a file.
  85.  ******************************************************************************/
  86. void CQTDoc::MakeNewContents()
  87. {
  88. }
  89.  
  90.  
  91. /******************************************************************************
  92.  ContentsToWindow
  93.  
  94.      Make window reflect document's contents.  If the document does
  95.      not use a file, this function is never called and may be deleted.
  96. ******************************************************************************/
  97. void CQTDoc::ContentsToWindow()
  98. {
  99. }
  100.  
  101.  
  102. /******************************************************************************
  103.  WindowToContents
  104.  
  105.      Make document's contents reflect window's contents (if they
  106.      don't already).  If the document does not use a file, this
  107.      function is never called and may be deleted.
  108. ******************************************************************************/
  109. void CQTDoc::WindowToContents()
  110. {
  111. }
  112.  
  113.  
  114. /******************************************************************************
  115.  DoCommand
  116.  
  117. ******************************************************************************/
  118. void CQTDoc::DoCommand(long theCommand)
  119. {
  120.     FSSpec    spec;
  121.  
  122.     switch (theCommand) 
  123.     {
  124.     case cmdImportMovieItem: 
  125.         if (GetMovieFileFSSpec(&spec)) 
  126.         {
  127.             ((CQTPane*)itsMainPane)->ImportMovie(&spec);
  128.             itsWindow->SetTitle(spec.name);
  129.         }
  130.         break;
  131.     default:    
  132.         inherited::DoCommand(theCommand);
  133.         break;
  134.     }
  135. }
  136.  
  137.  
  138. /******************************************************************************
  139.  UpdateMenus
  140.  
  141.     In this method you can enable menu commands that apply when
  142.     your document is active.
  143. ******************************************************************************/
  144. void CQTDoc::UpdateMenus()
  145. {
  146.     inherited::UpdateMenus();
  147.        
  148.     gBartender->EnableCmd(cmdImportMovieItem);  
  149. }
  150.  
  151.  
  152.  
  153.  
  154. /******************************************************************************
  155.  OpenQTFile
  156.  
  157.     Opens the movie file into a window
  158. ******************************************************************************/
  159. void CQTDoc::OpenQTFile(FSSpec    *movieSpec)
  160. {
  161.     MakeNewWindow();
  162.     ((CQTPane*)itsMainPane)->ImportMovie(movieSpec);
  163.     itsWindow->SetTitle(movieSpec->name);
  164.     itsWindow->Select();
  165. }
  166.  
  167.